package com.fessc.develop.job;

import com.fessc.develop.entity.dbvo.Enclosure;
import com.fessc.develop.handler.FileUploadPushHandler;
import com.fessc.develop.model.enums.EnumPushType;
import com.fessc.develop.model.enums.EnumTaskCode;
import com.fessc.develop.service.interfaces.IEnclosureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class FileUploadPushJob extends ScheduleJob{

    @Resource
    private IEnclosureService enclosureService;

    @Resource
    private FileUploadPushHandler fileUploadPushHandler;

    @Override
    public String execute() {
        //获取推送银行的结果集
        log.info("推送跨境付汇附件至银行处理");
        List<Enclosure> enclosureList = enclosureService.getEnclosureListToBank(getCCBBankId(), getTaskTermDate());
        fileUploadPushHandler.fileUploadPush(enclosureList, EnumPushType.PAYMENT_PUSH.toString());
        return null;
    }

    @Override
    public String getTaskCode() {
        return EnumTaskCode.FILE_UPLOAD_PUSH.toString();
    }
}
